using System;
using System.Threading;
using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;

namespace AvaloniaI18nTest.Views;

public partial class MainWindow : Window
{
    public MainWindow()
    {
        InitializeComponent();
    }

    private void Button_OnClick(object? sender, RoutedEventArgs e)
    {
        Console.WriteLine(Thread.CurrentThread.CurrentUICulture.Name);
        if (Thread.CurrentThread.CurrentUICulture.Equals(new System.Globalization.CultureInfo("zh")))
        {
            Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en"); 
        }
        else
        {
            Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("zh"); 
        }
        AvaloniaXamlLoader.Load(this);
    }
}